<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "sc_attr_value".
 *
 * @property integer $atv_id
 * @property integer $at_id
 * @property string $atv_name
 *
 * @property ScAttr $at
 */
class Scattrvalue extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'sc_attr_value';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['atv_id', 'atv_name'], 'required'],
            [['atv_id', 'at_id'], 'integer'],
            [['atv_name'], 'string', 'max' => 30]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'atv_id' => '属性值ID',
            'at_id' => '属性ID',
            'atv_name' => '属性名称',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getAt()
    {
        return $this->hasOne(ScAttr::className(), ['at_id' => 'at_id']);
    }
}
